﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using cmsservice.Entity;

namespace cmsservice.DAL
{
    /// <summary>
    /// 小额产品信息数据操作类
    /// </summary>
    public class SmallProductInfoDAL
    {
        /// <summary>
        /// 新增小额产品信息
        /// </summary>
        /// <param name="smallProductInfo"></param>
        /// <returns></returns>
        public int AddSmallProductInfo(SmallProductInfo smallProductInfo)
        {
            Tools paramTools = new Tools();

            paramTools.AddSqlParameter("ProductID", SqlDbType.Int, smallProductInfo.ProductID);
            paramTools.AddSqlParameter("UserID", SqlDbType.UniqueIdentifier, smallProductInfo.UserID);
            paramTools.AddSqlParameter("BuyTime", SqlDbType.DateTime, smallProductInfo.BuyTime);
            paramTools.AddSqlParameter("ExpireTime", SqlDbType.DateTime, smallProductInfo.ExpireTime);
            paramTools.AddSqlParameter("ValidateCode", SqlDbType.Int, smallProductInfo.ValidateCode);

            return SqlHelper.ExecuteNonQuery(DBConn.TemporaryDB, CommandType.Text, "INSERT INTO SmallProductInfo(ProductID,UserID,BuyTime,ExpireTime,ValidateCode) VALUES(@ProductID,@UserID,@BuyTime,@ExpireTime,@ValidateCode)", paramTools.GetSqlParameters());
        }
    }
}
